// Copyright 2018-2021 Polyaxon, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/* tslint:disable */
/* eslint-disable */
/**
 * Polyaxon SDKs and REST API specification.
 * Polyaxon SDKs and REST API specification.
 *
 * The version of the OpenAPI document: 1.7.4
 * Contact: contact@polyaxon.com
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


import * as runtime from '../runtime';
import {
    RuntimeError,
    RuntimeErrorFromJSON,
    RuntimeErrorToJSON,
    V1ComponentHub,
    V1ComponentHubFromJSON,
    V1ComponentHubToJSON,
    V1ComponentHubSettings,
    V1ComponentHubSettingsFromJSON,
    V1ComponentHubSettingsToJSON,
    V1ComponentVersion,
    V1ComponentVersionFromJSON,
    V1ComponentVersionToJSON,
    V1EntityStageBodyRequest,
    V1EntityStageBodyRequestFromJSON,
    V1EntityStageBodyRequestToJSON,
    V1ListActivitiesResponse,
    V1ListActivitiesResponseFromJSON,
    V1ListActivitiesResponseToJSON,
    V1ListComponentHubsResponse,
    V1ListComponentHubsResponseFromJSON,
    V1ListComponentHubsResponseToJSON,
    V1ListComponentVersionsResponse,
    V1ListComponentVersionsResponseFromJSON,
    V1ListComponentVersionsResponseToJSON,
    V1Stage,
    V1StageFromJSON,
    V1StageToJSON,
} from '../models';

export interface ArchiveComponentHubRequest {
    owner: string;
    name: string;
}

export interface BookmarkComponentHubRequest {
    owner: string;
    name: string;
}

export interface CreateComponentHubRequest {
    owner: string;
    body: V1ComponentHub;
}

export interface CreateComponentVersionRequest {
    owner: string;
    component: string;
    body: V1ComponentVersion;
}

export interface CreateComponentVersionStageRequest {
    owner: string;
    entity: string;
    name: string;
    body: V1EntityStageBodyRequest;
}

export interface DeleteComponentHubRequest {
    owner: string;
    name: string;
}

export interface DeleteComponentVersionRequest {
    owner: string;
    entity: string;
    name: string;
}

export interface GetComponentHubRequest {
    owner: string;
    name: string;
}

export interface GetComponentHubActivitiesRequest {
    owner: string;
    name: string;
    offset?: number;
    limit?: number;
    sort?: string;
    query?: string;
    mode?: string;
}

export interface GetComponentHubSettingsRequest {
    owner: string;
    name: string;
}

export interface GetComponentVersionRequest {
    owner: string;
    entity: string;
    name: string;
}

export interface GetComponentVersionStagesRequest {
    owner: string;
    entity: string;
    name: string;
}

export interface ListComponentHubNamesRequest {
    owner: string;
    offset?: number;
    limit?: number;
    sort?: string;
    query?: string;
}

export interface ListComponentHubsRequest {
    owner: string;
    offset?: number;
    limit?: number;
    sort?: string;
    query?: string;
}

export interface ListComponentVersionNamesRequest {
    owner: string;
    name: string;
    offset?: number;
    limit?: number;
    sort?: string;
    query?: string;
    mode?: string;
}

export interface ListComponentVersionsRequest {
    owner: string;
    name: string;
    offset?: number;
    limit?: number;
    sort?: string;
    query?: string;
    mode?: string;
}

export interface PatchComponentHubRequest {
    owner: string;
    componentName: string;
    body: V1ComponentHub;
}

export interface PatchComponentHubSettingsRequest {
    owner: string;
    component: string;
    body: V1ComponentHubSettings;
}

export interface PatchComponentVersionRequest {
    owner: string;
    component: string;
    versionName: string;
    body: V1ComponentVersion;
}

export interface RestoreComponentHubRequest {
    owner: string;
    name: string;
}

export interface UnbookmarkComponentHubRequest {
    owner: string;
    name: string;
}

export interface UpdateComponentHubRequest {
    owner: string;
    componentName: string;
    body: V1ComponentHub;
}

export interface UpdateComponentHubSettingsRequest {
    owner: string;
    component: string;
    body: V1ComponentHubSettings;
}

export interface UpdateComponentVersionRequest {
    owner: string;
    component: string;
    versionName: string;
    body: V1ComponentVersion;
}

/**
 * 
 */
export class ComponentHubV1Api extends runtime.BaseAPI {

    /**
     * Archive hub component
     */
    async archiveComponentHubRaw(requestParameters: ArchiveComponentHubRequest): Promise<runtime.ApiResponse<void>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling archiveComponentHub.');
        }

        if (requestParameters.name === null || requestParameters.name === undefined) {
            throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling archiveComponentHub.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/hub/{name}/archive`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Archive hub component
     */
    async archiveComponentHub(requestParameters: ArchiveComponentHubRequest): Promise<void> {
        await this.archiveComponentHubRaw(requestParameters);
    }

    /**
     * Bookmark component hub
     */
    async bookmarkComponentHubRaw(requestParameters: BookmarkComponentHubRequest): Promise<runtime.ApiResponse<void>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling bookmarkComponentHub.');
        }

        if (requestParameters.name === null || requestParameters.name === undefined) {
            throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling bookmarkComponentHub.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/hub/{name}/bookmark`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Bookmark component hub
     */
    async bookmarkComponentHub(requestParameters: BookmarkComponentHubRequest): Promise<void> {
        await this.bookmarkComponentHubRaw(requestParameters);
    }

    /**
     * Create hub component
     */
    async createComponentHubRaw(requestParameters: CreateComponentHubRequest): Promise<runtime.ApiResponse<V1ComponentHub>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling createComponentHub.');
        }

        if (requestParameters.body === null || requestParameters.body === undefined) {
            throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createComponentHub.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/hub/create`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))),
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: V1ComponentHubToJSON(requestParameters.body),
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ComponentHubFromJSON(jsonValue));
    }

    /**
     * Create hub component
     */
    async createComponentHub(requestParameters: CreateComponentHubRequest): Promise<V1ComponentHub> {
        const response = await this.createComponentHubRaw(requestParameters);
        return await response.value();
    }

    /**
     * Create component version
     */
    async createComponentVersionRaw(requestParameters: CreateComponentVersionRequest): Promise<runtime.ApiResponse<V1ComponentVersion>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling createComponentVersion.');
        }

        if (requestParameters.component === null || requestParameters.component === undefined) {
            throw new runtime.RequiredError('component','Required parameter requestParameters.component was null or undefined when calling createComponentVersion.');
        }

        if (requestParameters.body === null || requestParameters.body === undefined) {
            throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createComponentVersion.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/hub/{component}/versions`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"component"}}`, encodeURIComponent(String(requestParameters.component))),
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: V1ComponentVersionToJSON(requestParameters.body),
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ComponentVersionFromJSON(jsonValue));
    }

    /**
     * Create component version
     */
    async createComponentVersion(requestParameters: CreateComponentVersionRequest): Promise<V1ComponentVersion> {
        const response = await this.createComponentVersionRaw(requestParameters);
        return await response.value();
    }

    /**
     * Create new component version stage
     */
    async createComponentVersionStageRaw(requestParameters: CreateComponentVersionStageRequest): Promise<runtime.ApiResponse<V1Stage>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling createComponentVersionStage.');
        }

        if (requestParameters.entity === null || requestParameters.entity === undefined) {
            throw new runtime.RequiredError('entity','Required parameter requestParameters.entity was null or undefined when calling createComponentVersionStage.');
        }

        if (requestParameters.name === null || requestParameters.name === undefined) {
            throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling createComponentVersionStage.');
        }

        if (requestParameters.body === null || requestParameters.body === undefined) {
            throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createComponentVersionStage.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/hub/{entity}/versions/{name}/stages`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"entity"}}`, encodeURIComponent(String(requestParameters.entity))).replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: V1EntityStageBodyRequestToJSON(requestParameters.body),
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1StageFromJSON(jsonValue));
    }

    /**
     * Create new component version stage
     */
    async createComponentVersionStage(requestParameters: CreateComponentVersionStageRequest): Promise<V1Stage> {
        const response = await this.createComponentVersionStageRaw(requestParameters);
        return await response.value();
    }

    /**
     * Delete hub component
     */
    async deleteComponentHubRaw(requestParameters: DeleteComponentHubRequest): Promise<runtime.ApiResponse<void>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling deleteComponentHub.');
        }

        if (requestParameters.name === null || requestParameters.name === undefined) {
            throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling deleteComponentHub.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/hub/{name}`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Delete hub component
     */
    async deleteComponentHub(requestParameters: DeleteComponentHubRequest): Promise<void> {
        await this.deleteComponentHubRaw(requestParameters);
    }

    /**
     * Delete component version
     */
    async deleteComponentVersionRaw(requestParameters: DeleteComponentVersionRequest): Promise<runtime.ApiResponse<void>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling deleteComponentVersion.');
        }

        if (requestParameters.entity === null || requestParameters.entity === undefined) {
            throw new runtime.RequiredError('entity','Required parameter requestParameters.entity was null or undefined when calling deleteComponentVersion.');
        }

        if (requestParameters.name === null || requestParameters.name === undefined) {
            throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling deleteComponentVersion.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/hub/{entity}/versions/{name}`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"entity"}}`, encodeURIComponent(String(requestParameters.entity))).replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Delete component version
     */
    async deleteComponentVersion(requestParameters: DeleteComponentVersionRequest): Promise<void> {
        await this.deleteComponentVersionRaw(requestParameters);
    }

    /**
     * Get hub component
     */
    async getComponentHubRaw(requestParameters: GetComponentHubRequest): Promise<runtime.ApiResponse<V1ComponentHub>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling getComponentHub.');
        }

        if (requestParameters.name === null || requestParameters.name === undefined) {
            throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling getComponentHub.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/hub/{name}`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ComponentHubFromJSON(jsonValue));
    }

    /**
     * Get hub component
     */
    async getComponentHub(requestParameters: GetComponentHubRequest): Promise<V1ComponentHub> {
        const response = await this.getComponentHubRaw(requestParameters);
        return await response.value();
    }

    /**
     * Get hub activities
     */
    async getComponentHubActivitiesRaw(requestParameters: GetComponentHubActivitiesRequest): Promise<runtime.ApiResponse<V1ListActivitiesResponse>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling getComponentHubActivities.');
        }

        if (requestParameters.name === null || requestParameters.name === undefined) {
            throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling getComponentHubActivities.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        if (requestParameters.offset !== undefined) {
            queryParameters['offset'] = requestParameters.offset;
        }

        if (requestParameters.limit !== undefined) {
            queryParameters['limit'] = requestParameters.limit;
        }

        if (requestParameters.sort !== undefined) {
            queryParameters['sort'] = requestParameters.sort;
        }

        if (requestParameters.query !== undefined) {
            queryParameters['query'] = requestParameters.query;
        }

        if (requestParameters.mode !== undefined) {
            queryParameters['mode'] = requestParameters.mode;
        }

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/hub/{name}/activities`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ListActivitiesResponseFromJSON(jsonValue));
    }

    /**
     * Get hub activities
     */
    async getComponentHubActivities(requestParameters: GetComponentHubActivitiesRequest): Promise<V1ListActivitiesResponse> {
        const response = await this.getComponentHubActivitiesRaw(requestParameters);
        return await response.value();
    }

    /**
     * Get hub component settings
     */
    async getComponentHubSettingsRaw(requestParameters: GetComponentHubSettingsRequest): Promise<runtime.ApiResponse<V1ComponentHubSettings>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling getComponentHubSettings.');
        }

        if (requestParameters.name === null || requestParameters.name === undefined) {
            throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling getComponentHubSettings.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/hub/{name}/settings`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ComponentHubSettingsFromJSON(jsonValue));
    }

    /**
     * Get hub component settings
     */
    async getComponentHubSettings(requestParameters: GetComponentHubSettingsRequest): Promise<V1ComponentHubSettings> {
        const response = await this.getComponentHubSettingsRaw(requestParameters);
        return await response.value();
    }

    /**
     * Get component version
     */
    async getComponentVersionRaw(requestParameters: GetComponentVersionRequest): Promise<runtime.ApiResponse<V1ComponentVersion>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling getComponentVersion.');
        }

        if (requestParameters.entity === null || requestParameters.entity === undefined) {
            throw new runtime.RequiredError('entity','Required parameter requestParameters.entity was null or undefined when calling getComponentVersion.');
        }

        if (requestParameters.name === null || requestParameters.name === undefined) {
            throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling getComponentVersion.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/hub/{entity}/versions/{name}`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"entity"}}`, encodeURIComponent(String(requestParameters.entity))).replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ComponentVersionFromJSON(jsonValue));
    }

    /**
     * Get component version
     */
    async getComponentVersion(requestParameters: GetComponentVersionRequest): Promise<V1ComponentVersion> {
        const response = await this.getComponentVersionRaw(requestParameters);
        return await response.value();
    }

    /**
     * Get component version stages
     */
    async getComponentVersionStagesRaw(requestParameters: GetComponentVersionStagesRequest): Promise<runtime.ApiResponse<V1Stage>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling getComponentVersionStages.');
        }

        if (requestParameters.entity === null || requestParameters.entity === undefined) {
            throw new runtime.RequiredError('entity','Required parameter requestParameters.entity was null or undefined when calling getComponentVersionStages.');
        }

        if (requestParameters.name === null || requestParameters.name === undefined) {
            throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling getComponentVersionStages.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/hub/{entity}/versions/{name}/stages`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"entity"}}`, encodeURIComponent(String(requestParameters.entity))).replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1StageFromJSON(jsonValue));
    }

    /**
     * Get component version stages
     */
    async getComponentVersionStages(requestParameters: GetComponentVersionStagesRequest): Promise<V1Stage> {
        const response = await this.getComponentVersionStagesRaw(requestParameters);
        return await response.value();
    }

    /**
     * List hub component names
     */
    async listComponentHubNamesRaw(requestParameters: ListComponentHubNamesRequest): Promise<runtime.ApiResponse<V1ListComponentHubsResponse>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling listComponentHubNames.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        if (requestParameters.offset !== undefined) {
            queryParameters['offset'] = requestParameters.offset;
        }

        if (requestParameters.limit !== undefined) {
            queryParameters['limit'] = requestParameters.limit;
        }

        if (requestParameters.sort !== undefined) {
            queryParameters['sort'] = requestParameters.sort;
        }

        if (requestParameters.query !== undefined) {
            queryParameters['query'] = requestParameters.query;
        }

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/hub/names`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ListComponentHubsResponseFromJSON(jsonValue));
    }

    /**
     * List hub component names
     */
    async listComponentHubNames(requestParameters: ListComponentHubNamesRequest): Promise<V1ListComponentHubsResponse> {
        const response = await this.listComponentHubNamesRaw(requestParameters);
        return await response.value();
    }

    /**
     * List hub components
     */
    async listComponentHubsRaw(requestParameters: ListComponentHubsRequest): Promise<runtime.ApiResponse<V1ListComponentHubsResponse>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling listComponentHubs.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        if (requestParameters.offset !== undefined) {
            queryParameters['offset'] = requestParameters.offset;
        }

        if (requestParameters.limit !== undefined) {
            queryParameters['limit'] = requestParameters.limit;
        }

        if (requestParameters.sort !== undefined) {
            queryParameters['sort'] = requestParameters.sort;
        }

        if (requestParameters.query !== undefined) {
            queryParameters['query'] = requestParameters.query;
        }

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/hub/list`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ListComponentHubsResponseFromJSON(jsonValue));
    }

    /**
     * List hub components
     */
    async listComponentHubs(requestParameters: ListComponentHubsRequest): Promise<V1ListComponentHubsResponse> {
        const response = await this.listComponentHubsRaw(requestParameters);
        return await response.value();
    }

    /**
     * List component version names
     */
    async listComponentVersionNamesRaw(requestParameters: ListComponentVersionNamesRequest): Promise<runtime.ApiResponse<V1ListComponentVersionsResponse>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling listComponentVersionNames.');
        }

        if (requestParameters.name === null || requestParameters.name === undefined) {
            throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling listComponentVersionNames.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        if (requestParameters.offset !== undefined) {
            queryParameters['offset'] = requestParameters.offset;
        }

        if (requestParameters.limit !== undefined) {
            queryParameters['limit'] = requestParameters.limit;
        }

        if (requestParameters.sort !== undefined) {
            queryParameters['sort'] = requestParameters.sort;
        }

        if (requestParameters.query !== undefined) {
            queryParameters['query'] = requestParameters.query;
        }

        if (requestParameters.mode !== undefined) {
            queryParameters['mode'] = requestParameters.mode;
        }

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/hub/{name}/versions/names`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ListComponentVersionsResponseFromJSON(jsonValue));
    }

    /**
     * List component version names
     */
    async listComponentVersionNames(requestParameters: ListComponentVersionNamesRequest): Promise<V1ListComponentVersionsResponse> {
        const response = await this.listComponentVersionNamesRaw(requestParameters);
        return await response.value();
    }

    /**
     * List component versions
     */
    async listComponentVersionsRaw(requestParameters: ListComponentVersionsRequest): Promise<runtime.ApiResponse<V1ListComponentVersionsResponse>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling listComponentVersions.');
        }

        if (requestParameters.name === null || requestParameters.name === undefined) {
            throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling listComponentVersions.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        if (requestParameters.offset !== undefined) {
            queryParameters['offset'] = requestParameters.offset;
        }

        if (requestParameters.limit !== undefined) {
            queryParameters['limit'] = requestParameters.limit;
        }

        if (requestParameters.sort !== undefined) {
            queryParameters['sort'] = requestParameters.sort;
        }

        if (requestParameters.query !== undefined) {
            queryParameters['query'] = requestParameters.query;
        }

        if (requestParameters.mode !== undefined) {
            queryParameters['mode'] = requestParameters.mode;
        }

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/hub/{name}/versions`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ListComponentVersionsResponseFromJSON(jsonValue));
    }

    /**
     * List component versions
     */
    async listComponentVersions(requestParameters: ListComponentVersionsRequest): Promise<V1ListComponentVersionsResponse> {
        const response = await this.listComponentVersionsRaw(requestParameters);
        return await response.value();
    }

    /**
     * Patch hub component
     */
    async patchComponentHubRaw(requestParameters: PatchComponentHubRequest): Promise<runtime.ApiResponse<V1ComponentHub>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling patchComponentHub.');
        }

        if (requestParameters.componentName === null || requestParameters.componentName === undefined) {
            throw new runtime.RequiredError('componentName','Required parameter requestParameters.componentName was null or undefined when calling patchComponentHub.');
        }

        if (requestParameters.body === null || requestParameters.body === undefined) {
            throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling patchComponentHub.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/hub/{component.name}`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"component.name"}}`, encodeURIComponent(String(requestParameters.componentName))),
            method: 'PATCH',
            headers: headerParameters,
            query: queryParameters,
            body: V1ComponentHubToJSON(requestParameters.body),
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ComponentHubFromJSON(jsonValue));
    }

    /**
     * Patch hub component
     */
    async patchComponentHub(requestParameters: PatchComponentHubRequest): Promise<V1ComponentHub> {
        const response = await this.patchComponentHubRaw(requestParameters);
        return await response.value();
    }

    /**
     * Patch hub component settings
     */
    async patchComponentHubSettingsRaw(requestParameters: PatchComponentHubSettingsRequest): Promise<runtime.ApiResponse<V1ComponentHubSettings>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling patchComponentHubSettings.');
        }

        if (requestParameters.component === null || requestParameters.component === undefined) {
            throw new runtime.RequiredError('component','Required parameter requestParameters.component was null or undefined when calling patchComponentHubSettings.');
        }

        if (requestParameters.body === null || requestParameters.body === undefined) {
            throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling patchComponentHubSettings.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/hub/{component}/settings`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"component"}}`, encodeURIComponent(String(requestParameters.component))),
            method: 'PATCH',
            headers: headerParameters,
            query: queryParameters,
            body: V1ComponentHubSettingsToJSON(requestParameters.body),
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ComponentHubSettingsFromJSON(jsonValue));
    }

    /**
     * Patch hub component settings
     */
    async patchComponentHubSettings(requestParameters: PatchComponentHubSettingsRequest): Promise<V1ComponentHubSettings> {
        const response = await this.patchComponentHubSettingsRaw(requestParameters);
        return await response.value();
    }

    /**
     * Patch component version
     */
    async patchComponentVersionRaw(requestParameters: PatchComponentVersionRequest): Promise<runtime.ApiResponse<V1ComponentVersion>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling patchComponentVersion.');
        }

        if (requestParameters.component === null || requestParameters.component === undefined) {
            throw new runtime.RequiredError('component','Required parameter requestParameters.component was null or undefined when calling patchComponentVersion.');
        }

        if (requestParameters.versionName === null || requestParameters.versionName === undefined) {
            throw new runtime.RequiredError('versionName','Required parameter requestParameters.versionName was null or undefined when calling patchComponentVersion.');
        }

        if (requestParameters.body === null || requestParameters.body === undefined) {
            throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling patchComponentVersion.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/hub/{component}/versions/{version.name}`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"component"}}`, encodeURIComponent(String(requestParameters.component))).replace(`{${"version.name"}}`, encodeURIComponent(String(requestParameters.versionName))),
            method: 'PATCH',
            headers: headerParameters,
            query: queryParameters,
            body: V1ComponentVersionToJSON(requestParameters.body),
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ComponentVersionFromJSON(jsonValue));
    }

    /**
     * Patch component version
     */
    async patchComponentVersion(requestParameters: PatchComponentVersionRequest): Promise<V1ComponentVersion> {
        const response = await this.patchComponentVersionRaw(requestParameters);
        return await response.value();
    }

    /**
     * Restore hub component
     */
    async restoreComponentHubRaw(requestParameters: RestoreComponentHubRequest): Promise<runtime.ApiResponse<void>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling restoreComponentHub.');
        }

        if (requestParameters.name === null || requestParameters.name === undefined) {
            throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling restoreComponentHub.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/hub/{name}/restore`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Restore hub component
     */
    async restoreComponentHub(requestParameters: RestoreComponentHubRequest): Promise<void> {
        await this.restoreComponentHubRaw(requestParameters);
    }

    /**
     * Unbookmark component hub
     */
    async unbookmarkComponentHubRaw(requestParameters: UnbookmarkComponentHubRequest): Promise<runtime.ApiResponse<void>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling unbookmarkComponentHub.');
        }

        if (requestParameters.name === null || requestParameters.name === undefined) {
            throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling unbookmarkComponentHub.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/hub/{name}/unbookmark`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        });

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Unbookmark component hub
     */
    async unbookmarkComponentHub(requestParameters: UnbookmarkComponentHubRequest): Promise<void> {
        await this.unbookmarkComponentHubRaw(requestParameters);
    }

    /**
     * Update hub component
     */
    async updateComponentHubRaw(requestParameters: UpdateComponentHubRequest): Promise<runtime.ApiResponse<V1ComponentHub>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling updateComponentHub.');
        }

        if (requestParameters.componentName === null || requestParameters.componentName === undefined) {
            throw new runtime.RequiredError('componentName','Required parameter requestParameters.componentName was null or undefined when calling updateComponentHub.');
        }

        if (requestParameters.body === null || requestParameters.body === undefined) {
            throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updateComponentHub.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/hub/{component.name}`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"component.name"}}`, encodeURIComponent(String(requestParameters.componentName))),
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
            body: V1ComponentHubToJSON(requestParameters.body),
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ComponentHubFromJSON(jsonValue));
    }

    /**
     * Update hub component
     */
    async updateComponentHub(requestParameters: UpdateComponentHubRequest): Promise<V1ComponentHub> {
        const response = await this.updateComponentHubRaw(requestParameters);
        return await response.value();
    }

    /**
     * Update hub component settings
     */
    async updateComponentHubSettingsRaw(requestParameters: UpdateComponentHubSettingsRequest): Promise<runtime.ApiResponse<V1ComponentHubSettings>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling updateComponentHubSettings.');
        }

        if (requestParameters.component === null || requestParameters.component === undefined) {
            throw new runtime.RequiredError('component','Required parameter requestParameters.component was null or undefined when calling updateComponentHubSettings.');
        }

        if (requestParameters.body === null || requestParameters.body === undefined) {
            throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updateComponentHubSettings.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/hub/{component}/settings`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"component"}}`, encodeURIComponent(String(requestParameters.component))),
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
            body: V1ComponentHubSettingsToJSON(requestParameters.body),
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ComponentHubSettingsFromJSON(jsonValue));
    }

    /**
     * Update hub component settings
     */
    async updateComponentHubSettings(requestParameters: UpdateComponentHubSettingsRequest): Promise<V1ComponentHubSettings> {
        const response = await this.updateComponentHubSettingsRaw(requestParameters);
        return await response.value();
    }

    /**
     * Update component version
     */
    async updateComponentVersionRaw(requestParameters: UpdateComponentVersionRequest): Promise<runtime.ApiResponse<V1ComponentVersion>> {
        if (requestParameters.owner === null || requestParameters.owner === undefined) {
            throw new runtime.RequiredError('owner','Required parameter requestParameters.owner was null or undefined when calling updateComponentVersion.');
        }

        if (requestParameters.component === null || requestParameters.component === undefined) {
            throw new runtime.RequiredError('component','Required parameter requestParameters.component was null or undefined when calling updateComponentVersion.');
        }

        if (requestParameters.versionName === null || requestParameters.versionName === undefined) {
            throw new runtime.RequiredError('versionName','Required parameter requestParameters.versionName was null or undefined when calling updateComponentVersion.');
        }

        if (requestParameters.body === null || requestParameters.body === undefined) {
            throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updateComponentVersion.');
        }

        const queryParameters: runtime.HTTPQuery = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        if (this.configuration && this.configuration.apiKey) {
            headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
        }

        const response = await this.request({
            path: `/api/v1/{owner}/hub/{component}/versions/{version.name}`.replace(`{${"owner"}}`, encodeURIComponent(String(requestParameters.owner))).replace(`{${"component"}}`, encodeURIComponent(String(requestParameters.component))).replace(`{${"version.name"}}`, encodeURIComponent(String(requestParameters.versionName))),
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
            body: V1ComponentVersionToJSON(requestParameters.body),
        });

        return new runtime.JSONApiResponse(response, (jsonValue) => V1ComponentVersionFromJSON(jsonValue));
    }

    /**
     * Update component version
     */
    async updateComponentVersion(requestParameters: UpdateComponentVersionRequest): Promise<V1ComponentVersion> {
        const response = await this.updateComponentVersionRaw(requestParameters);
        return await response.value();
    }

}
